/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkStepperPeer } from "./peers/ArkStepperPeer"
import { UseEventsProperties } from "./use_properties"
import { CommonMethod } from "./ArkCommonInterfaces"
import { StepperAttribute } from "./ArkStepperInterfaces"
import { Callback_Void, Callback_Number_Number_Void, Callback_Number_Void, Literal_Number_index } from "./SyntheticDeclarations"
/** @memo:stable */
export class ArkStepperComponent extends ArkCommonMethodComponent {
    getPeer(): ArkStepperPeer {
        return (this.peer as ArkStepperPeer)
    }
    /** @memo */
    public setStepperOptions(value?: Literal_Number_index): this {
        if (this.checkPriority("setStepperOptions")) {
            const value_casted = value as (Literal_Number_index | undefined)
            this.getPeer()?.setStepperOptionsAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onFinish(value: (() => void)): this {
        if (this.checkPriority("onFinish")) {
            const value_casted = value as ((() => void))
            this.getPeer()?.onFinishAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onSkip(value: (() => void)): this {
        if (this.checkPriority("onSkip")) {
            const value_casted = value as ((() => void))
            this.getPeer()?.onSkipAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onChange(value: ((first: number,last: number) => void)): this {
        if (this.checkPriority("onChange")) {
            const value_casted = value as (((first: number,last: number) => void))
            this.getPeer()?.onChangeAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onNext(value: ((first: number,last: number) => void)): this {
        if (this.checkPriority("onNext")) {
            const value_casted = value as (((first: number,last: number) => void))
            this.getPeer()?.onNextAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public onPrevious(value: ((first: number,last: number) => void)): this {
        if (this.checkPriority("onPrevious")) {
            const value_casted = value as (((first: number,last: number) => void))
            this.getPeer()?.onPreviousAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public _onChangeEvent_index(callback: ((index: number) => void)): void {
        if (this.checkPriority("_onChangeEvent_index")) {
            const callback_casted = callback as (((index: number) => void))
            this.getPeer()?._onChangeEvent_indexAttribute(callback_casted)
            return
        }
        return
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkStepper(
  /** @memo */
  style: ((attributes: ArkStepperComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  value?: Literal_Number_index | undefined
) {
    const receiver = remember(() => {
        return new ArkStepperComponent()
    })
    NodeAttach<ArkStepperPeer>((): ArkStepperPeer => ArkStepperPeer.create(receiver), (_: ArkStepperPeer) => {
        receiver.setStepperOptions(value)
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
